Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
81ce3fe8
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看板
提交
81ce3fe8
编写于
3月 02, 2022
作者:
P
panqiangbiao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more xts
Signed-off-by:
N
panqiangbiao
<
panqiangbiao@huawei.com
>
上级
3be47e9c
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
3710 addition
and
303 deletion
+3710
-303
multimedia/medialibrary/mediaLibrary_js_standard/Test.json
multimedia/medialibrary/mediaLibrary_js_standard/Test.json
+2
-2
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/List.test.js
...ry/mediaLibrary_js_standard/src/main/js/test/List.test.js
+8
-0
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumGetFileAssetsPromise.test.js
...andard/src/main/js/test/albumGetFileAssetsPromise.test.js
+438
-0
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js
...ary_js_standard/src/main/js/test/albumTestPromise.test.js
+476
-257
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAsset2.test.js
...iaLibrary_js_standard/src/main/js/test/fileAsset2.test.js
+405
-0
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAssetTestPromise.test.js
...js_standard/src/main/js/test/fileAssetTestPromise.test.js
+893
-0
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestPromise.test.js
...rary_js_standard/src/main/js/test/fileTestPromise.test.js
+73
-44
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestPromise.test.js
...standard/src/main/js/test/mediaLibraryTestPromise.test.js
+1415
-0
未找到文件。
multimedia/medialibrary/mediaLibrary_js_standard/Test.json
浏览文件 @
81ce3fe8
...
...
@@ -2,9 +2,9 @@
"description"
:
"Configuration for mediaLibrary Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"
12
0000"
,
"test-timeout"
:
"
60
0000"
,
"package"
:
"ohos.acts.multimedia.mediaLibrary"
,
"shell-timeout"
:
"
12
0000"
"shell-timeout"
:
"
60
0000"
},
"kits"
:
[
{
...
...
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/List.test.js
浏览文件 @
81ce3fe8
...
...
@@ -15,3 +15,11 @@
require
(
'
./favoriteTestCallBack.test.js
'
)
require
(
'
./favoriteTestPromise.test.js
'
)
require
(
'
./fileTestPromise.test.js
'
)
require
(
'
./fileTestPromise.test.js
'
)
require
(
'
./favoriteTestPromise.test.js
'
)
require
(
'
./fileAsset2.test.js
'
)
require
(
'
./fileAssetTestPromise.test.js
'
)
require
(
'
./mediaLibraryTestPromise.test.js
'
)
require
(
'
./albumGetFileAssetsPromise.test.js
'
)
require
(
'
./albumTestPromise.test.js
'
)
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumGetFileAssetsPromise.test.js
0 → 100644
浏览文件 @
81ce3fe8
/*
* Copyright (C) 2022 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
mediaLibrary
from
'
@ohos.multimedia.medialibrary
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
describe
(
'
fileAssetTestPromise.test.js
'
,
async
function
()
{
var
context
=
featureAbility
.
getContext
();
console
.
info
(
'
MediaLibraryTest : getMediaLibrary IN
'
);
var
media
=
mediaLibrary
.
getMediaLibrary
(
context
);
console
.
info
(
'
MediaLibraryTest : getMediaLibrary OUT
'
);
beforeAll
(
function
()
{
});
beforeEach
(
function
()
{
});
afterEach
(
function
()
{
});
afterAll
(
function
()
{
});
const
fileKeyObj
=
mediaLibrary
.
FileKey
;
let
imageType
=
mediaLibrary
.
MediaType
.
IMAGE
;
let
videoType
=
mediaLibrary
.
MediaType
.
VIDEO
;
let
audioType
=
mediaLibrary
.
MediaType
.
AUDIO
;
const
count
=
3
;
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_01
* @tc.name : getFileAssets
* @tc.desc : more file type all
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_01
'
,
0
,
async
function
(
done
)
{
try
{
let
allTypefetchOp
=
{
selections
:
''
,
selectionArgs
:
[],
order
:
'
date_added DESC LIMIT 0,3
'
,
};
const
albumList
=
await
media
.
getAlbums
(
allTypefetchOp
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
allTypefetchOp
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_01 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_02
* @tc.name : getFileAssets
* @tc.desc : more file type image
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_02
'
,
0
,
async
function
(
done
)
{
try
{
let
imageAlbumfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
imageType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,3
'
,
};
const
albumList
=
await
media
.
getAlbums
(
imageAlbumfetchOp
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
imageAlbumfetchOp
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_02 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_02 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_03
* @tc.name : getFileAssets
* @tc.desc : more file type audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_03
'
,
0
,
async
function
(
done
)
{
try
{
let
audioAlbumfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
audioType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,3
'
,
};
const
albumList
=
await
media
.
getAlbums
(
audioAlbumfetchOp
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
audioAlbumfetchOp
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_03 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_03 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_04
* @tc.name : getFileAssets
* @tc.desc : more file type video
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_04
'
,
0
,
async
function
(
done
)
{
try
{
let
videoAlbumfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
videoType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,3
'
,
};
const
albumList
=
await
media
.
getAlbums
(
videoAlbumfetchOp
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
videoAlbumfetchOp
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_04 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_03 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05
* @tc.name : getFileAssets
* @tc.desc : more file type image and video
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05
'
,
0
,
async
function
(
done
)
{
try
{
let
imageAndVideoAlbumfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ? or
'
+
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
imageType
.
toString
(),
videoType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,3
'
,
};
const
albumList
=
await
media
.
getAlbums
(
imageAndVideoAlbumfetchOp
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
imageAndVideoAlbumfetchOp
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_05 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06
* @tc.name : getFileAssets
* @tc.desc : more file type image and audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06
'
,
0
,
async
function
(
done
)
{
try
{
let
imageAndAudioAlbumfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ? or
'
+
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
imageType
.
toString
(),
audioType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,3
'
,
};
const
albumList
=
await
media
.
getAlbums
(
imageAndAudioAlbumfetchOp
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
imageAndAudioAlbumfetchOp
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_06 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/** order: 'date_added DESC LIMIT 0,500'
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_07
* @tc.name : getFileAssets
* @tc.desc : more file type video and audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_07
'
,
0
,
async
function
(
done
)
{
try
{
let
videoAndAudioAlbumfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ? or
'
+
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
videoType
.
toString
(),
audioType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,3
'
,
};
const
albumList
=
await
media
.
getAlbums
(
videoAndAudioAlbumfetchOp
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
videoAndAudioAlbumfetchOp
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_07 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_07 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_08
* @tc.name : getFileAssets
* @tc.desc : more file type image video and audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_08
'
,
0
,
async
function
(
done
)
{
try
{
let
imgAndVideoAndAudioAlbumfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ? or
'
+
fileKeyObj
.
MEDIA_TYPE
+
'
= ? or
'
+
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
imageType
.
toString
(),
videoType
.
toString
(),
audioType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,3
'
,
};
const
albumList
=
await
media
.
getAlbums
(
imgAndVideoAndAudioAlbumfetchOp
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
imgAndVideoAndAudioAlbumfetchOp
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_08 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_08 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_09
* @tc.name : getFileAssets
* @tc.desc : one file tpe image
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_09
'
,
0
,
async
function
(
done
)
{
try
{
let
albumfetchOpOne
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
imageType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,1
'
,
};
const
albumList
=
await
media
.
getAlbums
(
albumfetchOpOne
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
albumfetchOpOne
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_09 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_09 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_10
* @tc.name : getFileAssets
* @tc.desc : one file type audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_10
'
,
0
,
async
function
(
done
)
{
try
{
let
albumfetchOpOne
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
audioType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,1
'
,
};
const
albumList
=
await
media
.
getAlbums
(
albumfetchOpOne
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
albumfetchOpOne
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_10 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_10 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_11
* @tc.name : getFileAssets
* @tc.desc : one file type audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_11
'
,
0
,
async
function
(
done
)
{
try
{
let
albumfetchOpOne
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
videoType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,1
'
,
};
const
albumList
=
await
media
.
getAlbums
(
albumfetchOpOne
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
albumfetchOpOne
);
expect
(
fetchFileResult
.
getCount
()
<=
count
).
assertTrue
();
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_11 count:
'
+
fetchFileResult
.
getCount
());
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_11 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_12
* @tc.name : getFileAssets
* @tc.desc : no file type image
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_12
'
,
0
,
async
function
(
done
)
{
try
{
let
albumfetchOpNone
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ? AND date_added < 0
'
,
selectionArgs
:
[
imageType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,1
'
,
};
const
albumList
=
await
media
.
getAlbums
(
albumfetchOpNone
);
const
album
=
albumList
[
0
];
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_12 albumId:
'
+
album
.
albumId
);
expect
(
album
.
albumId
==
0
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_12 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13
* @tc.name : getFileAssets
* @tc.desc : no file type audio
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13
'
,
0
,
async
function
(
done
)
{
try
{
let
albumfetchOpNone
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ? AND date_added < 0
'
,
selectionArgs
:
[
audioType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,1
'
,
};
const
albumList
=
await
media
.
getAlbums
(
albumfetchOpNone
);
const
album
=
albumList
[
0
];
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13 albumId:
'
+
album
.
albumId
);
expect
(
album
.
albumId
==
0
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_13 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_14
* @tc.name : getFileAssets
* @tc.desc : no file type video
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_14
'
,
0
,
async
function
(
done
)
{
try
{
let
albumfetchOpNone
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ? AND date_added < 0
'
,
selectionArgs
:
[
videoType
.
toString
()],
order
:
'
date_added DESC LIMIT 0,1
'
,
};
const
albumList
=
await
media
.
getAlbums
(
albumfetchOpNone
);
const
album
=
albumList
[
0
];
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_14 albumId:
'
+
album
.
albumId
);
expect
(
album
.
albumId
==
0
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : SUB_MEDIA_MEDIALIBRARY_ALBUM_GET_ASSETS_PROMISE_001_14 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
});
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/albumTestPromise.test.js
浏览文件 @
81ce3fe8
此差异已折叠。
点击以展开。
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAsset2.test.js
0 → 100644
浏览文件 @
81ce3fe8
/*
* 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
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
,
t_num
)
{
let
passed
=
true
for
(
const
key
in
asset
)
{
if
(
asset
[
key
]
==
undefined
)
{
passed
=
false
break
}
}
if
(
passed
)
{
console
.
info
(
`FileAssetTest : FileAsset checkAttrs
${
t_num
}
passed`
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
`FileAssetTest : FileAsset checkAttrs
${
t_num
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
}
describe
(
'
fileAsset2.test.js
'
,
async
function
()
{
let
fileKeyObj
=
mediaLibrary
.
FileKey
;
let
imageType
=
mediaLibrary
.
MediaType
.
IMAGE
;
let
videoType
=
mediaLibrary
.
MediaType
.
VIDEO
;
let
audioType
=
mediaLibrary
.
MediaType
.
AUDIO
;
let
imagesfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
imageType
.
toString
()],
};
let
videosfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
videoType
.
toString
()],
};
let
audiosfetchOp
=
{
selections
:
fileKeyObj
.
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
audioType
.
toString
()],
};
let
allTypefetchOp
=
{
selections
:
''
,
selectionArgs
:
[],
};
const
context
=
featureAbility
.
getContext
();
const
media
=
mediaLibrary
.
getMediaLibrary
(
context
);
beforeAll
(
function
()
{});
beforeEach
(
function
()
{});
afterEach
(
function
()
{});
afterAll
(
function
()
{});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_001
* @tc.name : commitModify
* @tc.desc : Modify displayName
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_commitModify_promise_001
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
const
newName
=
'
newName
'
;
asset
.
displayName
=
newName
;
const
id
=
asset
.
id
;
await
asset
.
commitModify
();
const
fetchFileResult2
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
dataList
=
await
fetchFileResult2
.
getAllObject
();
let
passed
=
false
;
for
(
let
i
=
0
;
i
<
dataList
.
length
;
i
++
)
{
const
asset
=
dataList
[
i
];
if
(
asset
.
id
==
id
&&
asset
.
displayName
==
newName
)
{
passed
=
true
;
break
;
}
}
expect
(
passed
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset commitModify 001 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_002
* @tc.name : commitModify
* @tc.desc : Modify title
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_commitModify_promise_002
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
const
newTitle
=
'
newTitle
'
;
asset
.
title
=
newTitle
;
const
id
=
asset
.
id
;
await
asset
.
commitModify
();
const
fetchFileResult2
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
dataList
=
await
fetchFileResult2
.
getAllObject
();
let
passed
=
false
;
for
(
let
i
=
0
;
i
<
dataList
.
length
;
i
++
)
{
const
asset
=
dataList
[
i
];
if
(
asset
.
id
==
id
&&
asset
.
title
==
newTitle
)
{
passed
=
true
;
break
;
}
}
expect
(
passed
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset commitModify 002 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_003
* @tc.name : commitModify
* @tc.desc : Modify relativePath
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_commitModify_promise_003
'
,
0
,
async
function
(
done
)
{
try
{
const
path1
=
await
media
.
getPublicDirectory
(
mediaLibrary
.
DirectoryType
.
DIR_IMAGE
);
const
path2
=
await
media
.
getPublicDirectory
(
mediaLibrary
.
DirectoryType
.
DIR_VIDEO
);
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
relativePath
=
asset
.
relativePath
;
let
newrelativePath
=
path1
;
if
(
relativePath
==
path1
)
{
newrelativePath
=
path2
;
}
asset
.
relativePath
=
newrelativePath
;
const
id
=
asset
.
id
;
await
asset
.
commitModify
();
const
fetchFileResult2
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
dataList
=
await
fetchFileResult2
.
getAllObject
();
let
passed
=
false
;
for
(
let
i
=
0
;
i
<
dataList
.
length
;
i
++
)
{
const
asset
=
dataList
[
i
];
if
(
asset
.
id
==
id
&&
asset
.
relativePath
==
newrelativePath
)
{
passed
=
true
;
break
;
}
}
expect
(
passed
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset commitModify 003 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_004
* @tc.name : commitModify
* @tc.desc : Modify orientation
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_commitModify_promise_004
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
neworientation
=
1
;
if
(
asset
.
orientation
==
1
)
{
neworientation
=
0
;
}
asset
.
orientation
=
neworientation
;
const
id
=
asset
.
id
;
await
asset
.
commitModify
();
const
fetchFileResult2
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
dataList
=
await
fetchFileResult2
.
getAllObject
();
let
passed
=
false
;
for
(
let
i
=
0
;
i
<
dataList
.
length
;
i
++
)
{
const
asset
=
dataList
[
i
];
if
(
asset
.
id
==
id
&&
asset
.
orientation
==
neworientation
)
{
passed
=
true
;
break
;
}
}
expect
(
passed
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset commitModify 004 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_005
* @tc.name : commitModify
* @tc.desc : Modify uri
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_commitModify_promise_005
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
const
id
=
asset
.
id
;
const
newUri
=
'
newUri
'
;
asset
.
uri
=
newUri
;
await
asset
.
commitModify
();
console
.
info
(
'
FileAssetTest : FileAsset commitModify 005 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset commitModify 005 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_006
* @tc.name : commitModify
* @tc.desc : Modify mediaType
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_commitModify_promise_006
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
const
id
=
asset
.
id
;
const
newMediaType
=
'
newMediaType
'
;
asset
.
mediaType
=
newMediaType
;
await
asset
.
commitModify
();
console
.
info
(
'
FileAssetTest : FileAsset commitModify 006 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset commitModify 006 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_isDirectory_promise_001
* @tc.name : isDirectory
* @tc.desc : isDirectory asset
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_isDirectory_promise_001
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
const
isDir
=
await
asset
.
isDirectory
();
expect
(
!
isDir
).
assertTrue
();
done
();
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset isDirectory 001 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_checkAttr_promise_001
* @tc.name : attrs
* @tc.desc : imagesfetchOp attrs print and check
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_checkAttr_promise_001
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
001
'
)
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset checkAttr 001 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_checkAttr_promise_002
* @tc.name : attrs
* @tc.desc : videosfetchOp attrs print and check
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_checkAttr_promise_002
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
videosfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
002
'
)
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset checkAttr 002 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_checkAttr_promise_003
* @tc.name : attrs
* @tc.desc : audiosfetchOp attrs print and check
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_checkAttr_promise_003
'
,
0
,
async
function
(
done
)
{
try
{
const
fetchFileResult
=
await
media
.
getFileAssets
(
audiosfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
003
'
)
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset checkAttr 003 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
/**
* @tc.number : SUB_MEDIA_FILEASSET_checkAttr_promise_004
* @tc.name : attrs
* @tc.desc : album attrs print and check
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
SUB_MEDIA_FILEASSET_checkAttr_promise_004
'
,
0
,
async
function
(
done
)
{
try
{
const
albumList
=
await
media
.
getAlbums
(
allTypefetchOp
);
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
allTypefetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
004
'
)
}
catch
(
error
)
{
console
.
info
(
'
FileAssetTest : FileAsset checkAttr 003 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
done
();
}
});
});
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAssetTestPromise.test.js
0 → 100644
浏览文件 @
81ce3fe8
此差异已折叠。
点击以展开。
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestPromise.test.js
浏览文件 @
81ce3fe8
...
...
@@ -41,17 +41,18 @@ let filesfetchOp = {
selectionArgs
:
[
fileType
.
toString
()],
};
function
checkAssetAttr
(
done
,
attr
,
test
N
um
,
asset
,
checkType
)
{
function
checkAssetAttr
(
done
,
attr
,
test
_n
um
,
asset
,
checkType
)
{
if
(
checkType
&&
asset
[
attr
]
!=
checkType
)
{
console
.
info
(
`MediaLibraryTest : ASSET_PROMISE getFileAssets
${
test
N
um
}
failed`
);
console
.
info
(
`MediaLibraryTest : ASSET_PROMISE getFileAssets
${
test
_n
um
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
else
if
(
asset
[
attr
]
==
undefined
)
{
console
.
info
(
`MediaLibraryTest : ASSET_PROMISE getFileAssets
${
test
N
um
}
failed`
);
console
.
info
(
`MediaLibraryTest : ASSET_PROMISE getFileAssets
${
test
_n
um
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
}
describe
(
'
file.promise.test.js
'
,
function
()
{
var
context
=
featureAbility
.
getContext
();
console
.
info
(
'
MediaLibraryTest : getMediaLibrary IN
'
);
...
...
@@ -84,7 +85,7 @@ describe('file.promise.test.js', function () {
const
fileAssets
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
dataList
=
await
fileAssets
.
getAllObject
();
const
asset1
=
dataList
[
0
];
const
creatAsset1
=
await
media
.
createAsset
(
imageType
,
'
image0
1
.jpg
'
,
path
);
const
creatAsset1
=
await
media
.
createAsset
(
imageType
,
'
image0
3
.jpg
'
,
path
);
const
fd1
=
await
asset1
.
open
(
'
rw
'
);
const
creatAssetFd1
=
await
creatAsset1
.
open
(
'
rw
'
);
await
copyFile
(
fd1
,
creatAssetFd1
);
...
...
@@ -92,7 +93,7 @@ describe('file.promise.test.js', function () {
await
asset1
.
close
(
fd1
);
const
asset2
=
dataList
[
1
];
const
creatAsset2
=
await
media
.
createAsset
(
imageType
,
'
image0
2
.jpg
'
,
path
);
const
creatAsset2
=
await
media
.
createAsset
(
imageType
,
'
image0
4
.jpg
'
,
path
);
const
fd2
=
await
asset2
.
open
(
'
rw
'
);
const
creatAssetFd2
=
await
creatAsset2
.
open
(
'
rw
'
);
await
copyFile
(
fd2
,
creatAssetFd2
);
...
...
@@ -248,15 +249,16 @@ describe('file.promise.test.js', function () {
const
fileAssets
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
dataList
=
await
fileAssets
.
getAllObject
();
const
asset
=
dataList
[
0
];
asset
.
displayName
=
'
hhhhhh
'
;
asset
.
commitModify
();
asset
.
title
=
`title_
${
new
Date
().
getTime
()}
`
;
a
wait
a
sset
.
commitModify
();
const
id
=
asset
.
id
;
const
idOP
=
{
selections
:
fileKeyObj
.
ID
+
'
= ?
'
,
selectionArgs
:
[
""
+
id
]
};
const
idOP
=
{
selections
:
fileKeyObj
.
ID
+
'
= ?
'
,
selectionArgs
:
[
''
+
id
]
};
const
newAssets
=
await
media
.
getFileAssets
(
idOP
);
const
newdataList
=
await
newAssets
.
getAllObject
();
const
newAsset
=
newdataList
[
0
];
if
(
newAsset
.
dateModified
!=
undefined
)
{
if
(
newAsset
.
dateModified
!=
asset
.
dateModified
)
{
if
(
asset
.
dateModified
!=
undefined
)
{
if
(
newAsset
.
dateModified
!=
asset
.
dateModified
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 001_07 passed
'
);
expect
(
true
).
assertTrue
();
done
();
...
...
@@ -266,9 +268,15 @@ describe('file.promise.test.js', function () {
done
();
}
}
else
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 001_07 failed
'
);
expect
(
false
).
assertTrue
();
done
();
if
(
newAsset
.
dateModified
!=
undefined
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 001_07 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 001_07 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 001_07 failed, message =
'
+
error
);
...
...
@@ -447,7 +455,7 @@ describe('file.promise.test.js', function () {
const
fileAssets
=
await
media
.
getFileAssets
(
videosfetchOp
);
const
dataList
=
await
fileAssets
.
getAllObject
();
const
asset1
=
dataList
[
0
];
const
creatAsset1
=
await
media
.
createAsset
(
videoType
,
'
video0
1
.mp4
'
,
path
);
const
creatAsset1
=
await
media
.
createAsset
(
videoType
,
'
video0
3
.mp4
'
,
path
);
const
fd1
=
await
asset1
.
open
(
'
rw
'
);
const
creatAssetFd1
=
await
creatAsset1
.
open
(
'
rw
'
);
await
copyFile
(
fd1
,
creatAssetFd1
);
...
...
@@ -455,7 +463,7 @@ describe('file.promise.test.js', function () {
await
asset1
.
close
(
fd1
);
const
asset2
=
dataList
[
0
];
const
creatAsset2
=
await
media
.
createAsset
(
videoType
,
'
video0
2
.mp4
'
,
path
);
const
creatAsset2
=
await
media
.
createAsset
(
videoType
,
'
video0
4
.mp4
'
,
path
);
const
fd2
=
await
asset2
.
open
(
'
rw
'
);
const
creatAssetFd2
=
await
creatAsset2
.
open
(
'
rw
'
);
await
copyFile
(
fd2
,
creatAssetFd2
);
...
...
@@ -610,15 +618,16 @@ describe('file.promise.test.js', function () {
const
fileAssets
=
await
media
.
getFileAssets
(
videosfetchOp
);
const
dataList
=
await
fileAssets
.
getAllObject
();
const
asset
=
dataList
[
0
];
asset
.
displayName
=
'
hhhhhh
'
;
asset
.
commitModify
();
asset
.
title
=
`title_
${
new
Date
().
getTime
()}
`
;
a
wait
a
sset
.
commitModify
();
const
id
=
asset
.
id
;
const
idOP
=
{
selections
:
fileKeyObj
.
ID
+
'
= ?
'
,
selectionArgs
:
[
""
+
id
]
};
const
idOP
=
{
selections
:
fileKeyObj
.
ID
+
'
= ?
'
,
selectionArgs
:
[
''
+
id
]
};
const
newAssets
=
await
media
.
getFileAssets
(
idOP
);
const
newdataList
=
await
newAssets
.
getAllObject
();
const
newAsset
=
newdataList
[
0
];
if
(
newAsset
.
dateModified
!=
undefined
)
{
if
(
newAsset
.
dateModified
!=
asset
.
dateModified
)
{
if
(
asset
.
dateModified
!=
undefined
)
{
if
(
newAsset
.
dateModified
!=
asset
.
dateModified
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 002_07 passed
'
);
expect
(
true
).
assertTrue
();
done
();
...
...
@@ -628,9 +637,15 @@ describe('file.promise.test.js', function () {
done
();
}
}
else
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 002_07 failed
'
);
expect
(
false
).
assertTrue
();
done
();
if
(
newAsset
.
dateModified
!=
undefined
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 002_07 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 002_07 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 002_07 failed, message =
'
+
error
);
...
...
@@ -839,7 +854,7 @@ describe('file.promise.test.js', function () {
const
fileAssets
=
await
media
.
getFileAssets
(
audiosfetchOp
);
const
dataList
=
await
fileAssets
.
getAllObject
();
const
asset1
=
dataList
[
0
];
const
creatAsset1
=
await
media
.
createAsset
(
audioType
,
'
audio0
1
.mp3
'
,
path
);
const
creatAsset1
=
await
media
.
createAsset
(
audioType
,
'
audio0
3
.mp3
'
,
path
);
const
fd1
=
await
asset1
.
open
(
'
rw
'
);
const
creatAssetFd1
=
await
creatAsset1
.
open
(
'
rw
'
);
await
copyFile
(
fd1
,
creatAssetFd1
);
...
...
@@ -847,7 +862,7 @@ describe('file.promise.test.js', function () {
await
asset1
.
close
(
fd1
);
const
asset2
=
dataList
[
0
];
const
creatAsset2
=
await
media
.
createAsset
(
audioType
,
'
audio0
2
.mp3
'
,
path
);
const
creatAsset2
=
await
media
.
createAsset
(
audioType
,
'
audio0
4
.mp3
'
,
path
);
const
fd2
=
await
asset2
.
open
(
'
rw
'
);
const
creatAssetFd2
=
await
creatAsset2
.
open
(
'
rw
'
);
await
copyFile
(
fd2
,
creatAssetFd2
);
...
...
@@ -1003,15 +1018,17 @@ describe('file.promise.test.js', function () {
const
fileAssets
=
await
media
.
getFileAssets
(
audiosfetchOp
);
const
dataList
=
await
fileAssets
.
getAllObject
();
const
asset
=
dataList
[
0
];
asset
.
displayName
=
'
hhhhhh
'
;
asset
.
commitModify
();
asset
.
title
=
`title_
${
new
Date
().
getTime
()}
`
;
await
asset
.
commitModify
();
const
id
=
asset
.
id
;
const
idOP
=
{
selections
:
fileKeyObj
.
ID
+
'
= ?
'
,
selectionArgs
:
[
""
+
id
]
};
const
idOP
=
{
selections
:
fileKeyObj
.
ID
+
'
= ?
'
,
selectionArgs
:
[
''
+
id
]
};
const
newAssets
=
await
media
.
getFileAssets
(
idOP
);
const
newdataList
=
await
newAssets
.
getAllObject
();
const
newAsset
=
newdataList
[
0
];
if
(
newAsset
.
dateModified
!=
undefined
)
{
if
(
newAsset
.
dateModified
!=
asset
.
dateModified
)
{
if
(
asset
.
dateModified
!=
undefined
)
{
if
(
newAsset
.
dateModified
!=
asset
.
dateModified
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 003_07 passed
'
);
expect
(
true
).
assertTrue
();
done
();
...
...
@@ -1021,9 +1038,15 @@ describe('file.promise.test.js', function () {
done
();
}
}
else
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 003_07 failed
'
);
expect
(
false
).
assertTrue
();
done
();
if
(
newAsset
.
dateModified
!=
undefined
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 003_07 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 003_07 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 003_07 failed, message =
'
+
error
);
...
...
@@ -1202,7 +1225,7 @@ describe('file.promise.test.js', function () {
const
fileAssets
=
await
media
.
getFileAssets
(
filesfetchOp
);
const
dataList
=
await
fileAssets
.
getAllObject
();
const
asset1
=
dataList
[
0
];
const
creatAsset1
=
await
media
.
createAsset
(
fileType
,
'
file0
1
.txt
'
,
path
);
const
creatAsset1
=
await
media
.
createAsset
(
fileType
,
'
file0
3
.txt
'
,
path
);
const
fd1
=
await
asset1
.
open
(
'
rw
'
);
const
creatAssetFd1
=
await
creatAsset1
.
open
(
'
rw
'
);
await
copyFile
(
fd1
,
creatAssetFd1
);
...
...
@@ -1210,7 +1233,7 @@ describe('file.promise.test.js', function () {
await
asset1
.
close
(
fd1
);
const
asset2
=
dataList
[
0
];
const
creatAsset2
=
await
media
.
createAsset
(
fileType
,
'
file0
2
.txt
'
,
path
);
const
creatAsset2
=
await
media
.
createAsset
(
fileType
,
'
file0
4
.txt
'
,
path
);
const
fd2
=
await
asset2
.
open
(
'
rw
'
);
const
creatAssetFd2
=
await
creatAsset2
.
open
(
'
rw
'
);
await
copyFile
(
fd2
,
creatAssetFd2
);
...
...
@@ -1366,15 +1389,16 @@ describe('file.promise.test.js', function () {
const
fileAssets
=
await
media
.
getFileAssets
(
filesfetchOp
);
const
dataList
=
await
fileAssets
.
getAllObject
();
const
asset
=
dataList
[
0
];
asset
.
displayName
=
'
hhhhhh
'
;
asset
.
commitModify
();
asset
.
title
=
`title_
${
new
Date
().
getTime
()}
`
;
a
wait
a
sset
.
commitModify
();
const
id
=
asset
.
id
;
const
idOP
=
{
selections
:
fileKeyObj
.
ID
+
'
= ?
'
,
selectionArgs
:
[
""
+
id
]
};
const
idOP
=
{
selections
:
fileKeyObj
.
ID
+
'
= ?
'
,
selectionArgs
:
[
''
+
id
]
};
const
newAssets
=
await
media
.
getFileAssets
(
idOP
);
const
newdataList
=
await
newAssets
.
getAllObject
();
const
newAsset
=
newdataList
[
0
];
if
(
newAsset
.
dateModified
!=
undefined
)
{
if
(
newAsset
.
dateModified
!=
asset
.
dateModified
)
{
if
(
asset
.
dateModified
!=
undefined
)
{
if
(
newAsset
.
dateModified
!=
asset
.
dateModified
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 004_07 passed
'
);
expect
(
true
).
assertTrue
();
done
();
...
...
@@ -1384,9 +1408,15 @@ describe('file.promise.test.js', function () {
done
();
}
}
else
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 004_07 failed
'
);
expect
(
false
).
assertTrue
();
done
();
if
(
newAsset
.
dateModified
!=
undefined
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 004_07 passed
'
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 004_07 failed
'
);
expect
(
false
).
assertTrue
();
done
();
}
}
}
catch
(
error
)
{
console
.
info
(
'
MediaLibraryTest : ASSET_PROMISE getFileAssets 004_07 failed, message =
'
+
error
);
...
...
@@ -1461,4 +1491,3 @@ describe('file.promise.test.js', function () {
});
// ------------------------------- file type end -----------------------------
});
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/mediaLibraryTestPromise.test.js
0 → 100644
浏览文件 @
81ce3fe8
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录