未验证 提交 d6b17a78 编写于 作者: O openharmony_ci 提交者: Gitee

!2216 增加offset(文件偏移个数)参数校验

Merge pull request !2216 from zhangxingxia/master
...@@ -10,26 +10,26 @@ ...@@ -10,26 +10,26 @@
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"mkdir /storage/media/100/local/files/photo", "mkdir -p /storage/media/100/local/files/photo",
"mkdir /storage/media/100/local/files/document", "mkdir -p /storage/media/100/local/files/document",
"mkdir /storage/media/100/local/files/video", "mkdir -p /storage/media/100/local/files/video",
"mkdir /storage/media/100/local/files/audio", "mkdir -p /storage/media/100/local/files/audio",
"mkdir /storage/media/100/local/files/photo/weixin", "mkdir -p /storage/media/100/local/files/photo/weixin",
"touch /storage/media/100/local/files/photo/weixin/1.jpg", "touch /storage/media/100/local/files/photo/weixin/1.jpg",
"touch /storage/media/100/local/files/photo/weixin/2.jpg", "touch /storage/media/100/local/files/photo/weixin/2.jpg",
"touch /storage/media/100/local/files/photo/weixin/3.jpg", "touch /storage/media/100/local/files/photo/weixin/3.jpg",
"touch /storage/media/100/local/files/photo/weixin/1.mp3", "touch /storage/media/100/local/files/photo/weixin/1.mp3",
"touch /storage/media/100/local/files/photo/weixin/1.mp4", "touch /storage/media/100/local/files/photo/weixin/1.mp4",
"mkdir /storage/media/100/local/files/photo/taobao", "mkdir -p /storage/media/100/local/files/photo/taobao",
"touch /storage/media/100/local/files/photo/taobao/1.mp4", "touch /storage/media/100/local/files/photo/taobao/1.mp4",
"mkdir /storage/media/100/local/files/taobao", "mkdir -p /storage/media/100/local/files/taobao",
"touch /storage/media/100/local/files/taobao/1.jpg", "touch /storage/media/100/local/files/taobao/1.jpg",
"mkdir /storage/media/100/local/files/image", "mkdir -p /storage/media/100/local/files/image",
"touch /storage/media/100/local/files/image/1.jpg", "touch /storage/media/100/local/files/image/1.jpg",
"touch /storage/media/100/local/files/image/2.jpg", "touch /storage/media/100/local/files/image/2.jpg",
"mkdir /storage/media/100/local/files/alarms", "mkdir -p /storage/media/100/local/files/alarms",
"touch /storage/media/100/local/files/alarms/tree.mp3", "touch /storage/media/100/local/files/alarms/tree.mp3",
"mkdir /storage/media/100/local/files/wps", "mkdir -p /storage/media/100/local/files/wps",
"touch /storage/media/100/local/files/wps/news.pdf", "touch /storage/media/100/local/files/wps/news.pdf",
"touch /storage/media/100/local/files/wps/introduce.doc", "touch /storage/media/100/local/files/wps/introduce.doc",
"killall com.ohos.medialibrary.MediaScannerAbilityA", "killall com.ohos.medialibrary.MediaScannerAbilityA",
......
...@@ -35,6 +35,7 @@ let FILE_ROOT = ""; ...@@ -35,6 +35,7 @@ let FILE_ROOT = "";
let AUDIO_ROOT = ""; let AUDIO_ROOT = "";
let IMAGE_ALBUM = ""; let IMAGE_ALBUM = "";
let LOG_ = "FMS_XTS_TEXT: "; let LOG_ = "FMS_XTS_TEXT: ";
let LENGTH = 0;
describe("filemanager_test", function () { describe("filemanager_test", function () {
/** /**
...@@ -242,10 +243,16 @@ describe("filemanager_test", function () { ...@@ -242,10 +243,16 @@ describe("filemanager_test", function () {
it("filemanager_test_list_file_async_002", 0, async function (done) { it("filemanager_test_list_file_async_002", 0, async function (done) {
try { try {
let path = FILE_ROOT; let path = FILE_ROOT;
filemanager.listFile(path, "file", function(error,fileInfos){ let options = {
expect(Array.isArray(fileInfos)).assertTrue(); dev:{
done(); "name":"local"
}); },
offset:0
};
let fileInfos = await filemanager.listFile(path, "file",options);
LENGTH = fileInfos.length;
expect(Array.isArray(fileInfos)).assertTrue();
done();
} catch (error) { } catch (error) {
console.log("filemanager_test_list_file_async_002 has failed for " + error); console.log("filemanager_test_list_file_async_002 has failed for " + error);
expect(null).assertFail(); expect(null).assertFail();
...@@ -302,6 +309,7 @@ describe("filemanager_test", function () { ...@@ -302,6 +309,7 @@ describe("filemanager_test", function () {
}; };
filemanager.listFile(path, "file", options, function(error,fileInfos){ filemanager.listFile(path, "file", options, function(error,fileInfos){
expect(Array.isArray(fileInfos)).assertTrue(); expect(Array.isArray(fileInfos)).assertTrue();
expect(fileInfos.length == LENGTH-2).assertTrue();
done(); done();
}); });
} catch (error) { } catch (error) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册