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

!9893 给documentPicker补充新的XTS测试用例

Merge pull request !9893 from yxn22/cherry-pick-1693042552
......@@ -25,7 +25,7 @@ export default function documentPickerCallback(abilityContext) {
await sleep(500);
})
async function select(testNum, done, dirName, fileName) {
async function select(testNum, done) {
try {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select((err, result) => {
......@@ -48,7 +48,7 @@ export default function documentPickerCallback(abilityContext) {
}
}
async function selectWithOption(testNum, done, option, dirName, fileName) {
async function selectWithOption(testNum, done, option) {
try {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select(option, (err, result) => {
......@@ -94,7 +94,7 @@ export default function documentPickerCallback(abilityContext) {
}
}
async function saveWithOption(testNum, done, option, dirName) {
async function saveWithOption(testNum, done, option) {
try {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.save(option, (err, result) => {
......@@ -125,12 +125,10 @@ export default function documentPickerCallback(abilityContext) {
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_callback_000", 0, async function (done) {
it("documentpicker_select_callback_000", 1, async function (done) {
let testNum = "documentpicker_select_callback_000";
let option = new picker.DocumentSelectOptions();
let dirName = "Pictures";
let fileName = "01.jpg";
await selectWithOption(testNum, done, option, dirName, fileName);
await selectWithOption(testNum, done, option);
});
/**
......@@ -139,13 +137,101 @@ export default function documentPickerCallback(abilityContext) {
* @tc.desc : select without option
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
* @tc.level : Level 1
*/
it("documentpicker_select_callback_001", 0, async function (done) {
it("documentpicker_select_callback_001", 1, async function (done) {
let testNum = "documentpicker_select_callback_001";
let dirName = "Pictures";
let fileName = "01.jpg";
await select(testNum, done, dirName, fileName);
await select(testNum, done);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_CALLBACK_0200
* @tc.name : documentpicker_select_callback_002
* @tc.desc : select with option maxSelectNumber
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_callback_002", 1, async function (done) {
let testNum = "documentpicker_select_callback_002";
let option = new picker.DocumentSelectOptions();
option.maxSelectNumber = 3;
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_CALLBACK_0300
* @tc.name : documentpicker_select_callback_003
* @tc.desc : select with option defaultFilePathUri
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_callback_003", 1, async function (done) {
let testNum = "documentpicker_select_callback_003";
let option = new picker.DocumentSelectOptions();
option.defaultFilePathUri = "file://docs/storage/Users/currentUser/test/test1";
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_CALLBACK_0400
* @tc.name : documentpicker_select_callback_004
* @tc.desc : select with option image fileSuffixFilters
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_callback_004", 1, async function (done) {
let testNum = "documentpicker_select_callback_004";
let option = new picker.DocumentSelectOptions();
option.fileSuffixFilters = ['.png', '.jpg'];
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_CALLBACK_0500
* @tc.name : documentpicker_select_callback_005
* @tc.desc : select with option docs fileSuffixFilters
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_callback_005", 1, async function (done) {
let testNum = "documentpicker_select_callback_005";
let option = new picker.DocumentSelectOptions();
option.fileSuffixFilters = ['.pptx', '.docx', '.xlsx', '.txt'];
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_CALLBACK_0600
* @tc.name : documentpicker_select_callback_006
* @tc.desc : select with option video fileSuffixFilters
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_callback_006", 1, async function (done) {
let testNum = "documentpicker_select_callback_006";
let option = new picker.DocumentSelectOptions();
option.fileSuffixFilters = ['.mp4'];
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_CALLBACK_0700
* @tc.name : documentpicker_select_callback_007
* @tc.desc : select with option audio fileSuffixFilters
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_callback_007", 1, async function (done) {
let testNum = "documentpicker_select_callback_007";
let option = new picker.DocumentSelectOptions();
option.fileSuffixFilters = ['.mp3'];
await selectWithOption(testNum, done, option);
});
/**
......@@ -160,8 +246,7 @@ export default function documentPickerCallback(abilityContext) {
let testNum = "documentpicker_save_callback_000";
let option = new picker.DocumentSaveOptions();
option.newFileNames = ["DocumentViewPicker01.jpg"];
let saveDir = "Pictures";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -172,12 +257,11 @@ export default function documentPickerCallback(abilityContext) {
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_save_callback_001", 0, async function (done) {
it("documentpicker_save_callback_001", 1, async function (done) {
let testNum = "documentpicker_save_callback_001";
let option = new picker.DocumentSaveOptions();
option.newFileNames = ["DocumentViewPicker01.dat"];
let saveDir = "Documents";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -188,12 +272,11 @@ export default function documentPickerCallback(abilityContext) {
* @tc.type : Function
* @tc.level : Level 3
*/
it("documentpicker_save_callback_002", 0, async function (done) {
it("documentpicker_save_callback_002", 3, async function (done) {
let testNum = "documentpicker_save_callback_002";
let option = new picker.DocumentSaveOptions();
option.newFileNames = ["DocumentViewPicker01.mp4"];
let saveDir = "Videos";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -204,12 +287,11 @@ export default function documentPickerCallback(abilityContext) {
* @tc.type : Function
* @tc.level : Level 3
*/
it("documentpicker_save_callback_003", 0, async function (done) {
it("documentpicker_save_callback_003", 3, async function (done) {
let testNum = "documentpicker_save_callback_003";
let option = new picker.DocumentSaveOptions();
option.newFileNames = ["DocumentViewPicker01.mp3"];
let saveDir = "Audios";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -220,9 +302,84 @@ export default function documentPickerCallback(abilityContext) {
* @tc.type : Function
* @tc.level : Level 3
*/
it("documentpicker_save_callback_004", 0, async function (done) {
it("documentpicker_save_callback_004", 3, async function (done) {
let testNum = "documentpicker_save_callback_004";
await saveWithoutSelect(testNum, done);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SAVE_CALLBACK_0500
* @tc.name : documentpicker_save_callback_005
* @tc.desc : save png in Pictures
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_save_callback_005", 1, async function (done) {
let testNum = "documentpicker_save_callback_005";
let option = new picker.DocumentSaveOptions();
option.defaultFilePathUri = "file://docs/storage/Users/currentUser/test/test1/202308171505.png";
await saveWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SAVE_CALLBACK_0600
* @tc.name : documentpicker_save_callback_006
* @tc.desc : save suffix in Pictures
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_save_callback_006", 1, async function (done) {
let testNum = "documentpicker_save_callback_006";
let option = new picker.DocumentSaveOptions();
option.fileSuffixChoices = ['.png', '.jpg'];
await saveWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SAVE_CALLBACK_0700
* @tc.name : documentpicker_save_callback_007
* @tc.desc : save suffix in Documents
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_save_callback_007", 1, async function (done) {
let testNum = "documentpicker_save_callback_007";
let option = new picker.DocumentSaveOptions();
option.fileSuffixChoices = ['.pptx', '.docx', '.xlsx', '.txt'];
await saveWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SAVE_CALLBACK_0800
* @tc.name : documentpicker_save_callback_008
* @tc.desc : save mp4 in Videos
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_save_callback_008", 1, async function (done) {
let testNum = "documentpicker_save_callback_008";
let option = new picker.DocumentSaveOptions();
option.fileSuffixChoices = ['.mp4'];
await saveWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SAVE_CALLBACK_0900
* @tc.name : documentpicker_save_callback_009
* @tc.desc : save mp3 in Audios
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_save_callback_009", 1, async function (done) {
let testNum = "documentpicker_save_callback_009";
let option = new picker.DocumentSaveOptions();
option.fileSuffixChoices = ['.mp3'];
await saveWithOption(testNum, done, option);
});
});
}
......@@ -25,7 +25,7 @@ export default function documentPickerPromise(abilityContext) {
await sleep(500);
})
async function select(testNum, done, dirName, fileName) {
async function select(testNum, done) {
try {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select().then((result) => {
......@@ -47,7 +47,7 @@ export default function documentPickerPromise(abilityContext) {
}
}
async function selectWithOption(testNum, done, option, dirName?, fileName?) {
async function selectWithOption(testNum, done, option) {
try {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.select(option).then((result) => {
......@@ -91,7 +91,7 @@ export default function documentPickerPromise(abilityContext) {
}
}
async function saveWithOption(testNum, done, option, dirName) {
async function saveWithOption(testNum, done, option) {
try {
let documentPicker = new picker.DocumentViewPicker();
documentPicker.save(option).then((result) => {
......@@ -121,12 +121,10 @@ export default function documentPickerPromise(abilityContext) {
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_promise_000", 0, async function (done) {
it("documentpicker_select_promise_000", 1, async function (done) {
let testNum = "documentpicker_select_promise_000";
let option = new picker.DocumentSelectOptions();
let dirName = "Pictures";
let fileName = "01.jpg";
await selectWithOption(testNum, done, option, dirName, fileName);
await selectWithOption(testNum, done, option);
});
/**
......@@ -135,125 +133,101 @@ export default function documentPickerPromise(abilityContext) {
* @tc.desc : select without option
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
* @tc.level : Level 1
*/
it("documentpicker_select_promise_001", 0, async function (done) {
it("documentpicker_select_promise_001", 1, async function (done) {
let testNum = "documentpicker_select_promise_001";
let dirName = "Pictures";
let fileName = "01.jpg";
await select(testNum, done, dirName, fileName);
await select(testNum, done);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_PROMISE_0200
* @tc.name : documentpicker_select_promise_002
* @tc.desc : select with option
* @tc.desc : select with option maxSelectNumber
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_promise_002", 0, async function (done) {
it("documentpicker_select_promise_002", 1, async function (done) {
let testNum = "documentpicker_select_promise_002";
let option = new picker.DocumentSelectOptions();
option.maxSelectNumber = 3;
let dirName = "Pictures";
await selectWithOption(testNum, done, option, dirName);
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_PROMISE_0300
* @tc.name : documentpicker_select_promise_003
* @tc.desc : select with option
* @tc.desc : select with option defaultFilePathUri
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_promise_003", 0, async function (done) {
it("documentpicker_select_promise_003", 1, async function (done) {
let testNum = "documentpicker_select_promise_003";
let option = new picker.DocumentSelectOptions();
option.defaultFilePathUri = "file://media/file/8";
let dirName = "Pictures";
await selectWithOption(testNum, done, option, dirName);
option.defaultFilePathUri = "file://docs/storage/Users/currentUser/test/test1";
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_PROMISE_0400
* @tc.name : documentpicker_select_promise_004
* @tc.desc : select with option
* @tc.desc : select with option image fileSuffixFilters
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_promise_004", 0, async function (done) {
it("documentpicker_select_promise_004", 1, async function (done) {
let testNum = "documentpicker_select_promise_004";
let option = new picker.DocumentSelectOptions();
option.defaultFilePathUri = "file://docs/storage/Users/currentUser/test/test1";
let dirName = "Pictures";
await selectWithOption(testNum, done, option, dirName);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_PROMISE_0500
* @tc.name : documentpicker_select_promise_005
* @tc.desc : select with option
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_promise_005", 0, async function (done) {
let testNum = "documentpicker_select_promise_005";
let option = new picker.DocumentSelectOptions();
option.fileSuffixFilters = ['.png', '.jpg'];
let dirName = "Pictures";
await selectWithOption(testNum, done, option, dirName);
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_PROMISE_0500
* @tc.name : documentpicker_select_promise_005
* @tc.desc : select with option
* @tc.desc : select with option docs fileSuffixFilters
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_promise_005", 0, async function (done) {
it("documentpicker_select_promise_005", 1, async function (done) {
let testNum = "documentpicker_select_promise_005";
let option = new picker.DocumentSelectOptions();
option.fileSuffixFilters = ['.pptx', '.docx', '.xlsx', '.txt'];
let dirName = "Documents";
await selectWithOption(testNum, done, option, dirName);
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_PROMISE_0600
* @tc.name : documentpicker_select_promise_006
* @tc.desc : select with option
* @tc.desc : select with option video fileSuffixFilters
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_promise_006", 0, async function (done) {
it("documentpicker_select_promise_006", 1, async function (done) {
let testNum = "documentpicker_select_promise_006";
let option = new picker.DocumentSelectOptions();
option.fileSuffixFilters = ['.mp4'];
let dirName = "Videos";
await selectWithOption(testNum, done, option, dirName);
await selectWithOption(testNum, done, option);
});
/**
* @tc.number : SUB_STORAGE_DOCUMENTPICKER_SELECT_PROMISE_0700
* @tc.name : documentpicker_select_promise_007
* @tc.desc : select with option
* @tc.desc : select with option audio fileSuffixFilters
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_select_promise_007", 0, async function (done) {
it("documentpicker_select_promise_007", 1, async function (done) {
let testNum = "documentpicker_select_promise_007";
let option = new picker.DocumentSelectOptions();
option.fileSuffixFilters = ['.mp3'];
let dirName = "Audios";
await selectWithOption(testNum, done, option, dirName);
await selectWithOption(testNum, done, option);
});
/**
......@@ -268,8 +242,7 @@ export default function documentPickerPromise(abilityContext) {
let testNum = "documentpicker_save_promise_000";
let option = new picker.DocumentSaveOptions();
option.newFileNames = ["DocumentViewPicker01.jpg"];
let saveDir = "Pictures";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -280,12 +253,11 @@ export default function documentPickerPromise(abilityContext) {
* @tc.type : Function
* @tc.level : Level 1
*/
it("documentpicker_save_promise_001", 0, async function (done) {
it("documentpicker_save_promise_001", 1, async function (done) {
let testNum = "documentpicker_save_promise_001";
let option = new picker.DocumentSaveOptions();
option.newFileNames = ["DocumentViewPicker01.dat"];
let saveDir = "Documents";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -296,12 +268,11 @@ export default function documentPickerPromise(abilityContext) {
* @tc.type : Function
* @tc.level : Level 3
*/
it("documentpicker_save_promise_002", 0, async function (done) {
it("documentpicker_save_promise_002", 3, async function (done) {
let testNum = "documentpicker_save_promise_002";
let option = new picker.DocumentSaveOptions();
option.newFileNames = ["DocumentViewPicker01.mp4"];
let saveDir = "Videos";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -312,12 +283,11 @@ export default function documentPickerPromise(abilityContext) {
* @tc.type : Function
* @tc.level : Level 3
*/
it("documentpicker_save_promise_003", 0, async function (done) {
it("documentpicker_save_promise_003", 3, async function (done) {
let testNum = "documentpicker_save_promise_003";
let option = new picker.DocumentSaveOptions();
option.newFileNames = ["DocumentViewPicker01.mp3"];
let saveDir = "Audios";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -326,14 +296,13 @@ export default function documentPickerPromise(abilityContext) {
* @tc.desc : save uri in Pictures
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
* @tc.level : Level 1
*/
it("documentpicker_save_promise_004", 0, async function (done) {
it("documentpicker_save_promise_004", 1, async function (done) {
let testNum = "documentpicker_save_promise_004";
let option = new picker.DocumentSaveOptions();
option.defaultFilePathUri = "file://media/file/8";
let saveDir = "Pictures";
await saveWithOption(testNum, done, option, saveDir);
option.defaultFilePathUri = "file://docs/storage/Users/currentUser/test";
await saveWithOption(testNum, done, option);
});
/**
......@@ -342,14 +311,13 @@ export default function documentPickerPromise(abilityContext) {
* @tc.desc : save png in Pictures
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
* @tc.level : Level 1
*/
it("documentpicker_save_promise_005", 0, async function (done) {
it("documentpicker_save_promise_005", 1, async function (done) {
let testNum = "documentpicker_save_promise_005";
let option = new picker.DocumentSaveOptions();
option.defaultFilePathUri = "file://docs/storage/Users/currentUser/test/test1/202308171505.png";
let saveDir = "Pictures";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -358,14 +326,13 @@ export default function documentPickerPromise(abilityContext) {
* @tc.desc : save suffix in Pictures
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
* @tc.level : Level 1
*/
it("documentpicker_save_promise_006", 0, async function (done) {
it("documentpicker_save_promise_006", 1, async function (done) {
let testNum = "documentpicker_save_promise_006";
let option = new picker.DocumentSaveOptions();
option.fileSuffixChoices = ['.png', '.jpg'];
let saveDir = "Pictures";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -374,14 +341,13 @@ export default function documentPickerPromise(abilityContext) {
* @tc.desc : save suffix in Documents
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
* @tc.level : Level 1
*/
it("documentpicker_save_promise_007", 0, async function (done) {
it("documentpicker_save_promise_007", 1, async function (done) {
let testNum = "documentpicker_save_promise_007";
let option = new picker.DocumentSaveOptions();
option.fileSuffixChoices = ['.pptx', '.docx', '.xlsx', '.txt'];
let saveDir = "Documents";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -390,14 +356,13 @@ export default function documentPickerPromise(abilityContext) {
* @tc.desc : save mp4 in Videos
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
* @tc.level : Level 1
*/
it("documentpicker_save_promise_008", 0, async function (done) {
it("documentpicker_save_promise_008", 1, async function (done) {
let testNum = "documentpicker_save_promise_008";
let option = new picker.DocumentSaveOptions();
option.fileSuffixChoices = ['.mp4'];
let saveDir = "Videos";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
/**
......@@ -406,14 +371,13 @@ export default function documentPickerPromise(abilityContext) {
* @tc.desc : save mp3 in Audios
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
* @tc.level : Level 1
*/
it("documentpicker_save_promise_009", 0, async function (done) {
it("documentpicker_save_promise_009", 1, async function (done) {
let testNum = "documentpicker_save_promise_009";
let option = new picker.DocumentSaveOptions();
option.fileSuffixChoices = ['.mp3'];
let saveDir = "Audios";
await saveWithOption(testNum, done, option, saveDir);
await saveWithOption(testNum, done, option);
});
});
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册